package com.epalmpay.service.datareport.impl;

import javax.annotation.Resource;

import com.epalmpay.entity.*;
import com.epalmpay.enumdef.BizEnum;
import com.epalmpay.mapper.*;
import org.springframework.stereotype.Service;

import com.epalmpay.dto.datareport.TransDataReportInDTO;
import com.epalmpay.service.datareport.ITransDataReportService;

@Service("transDataReportService")
public class TransDataReportServiceImpl implements ITransDataReportService{
	
	@Resource
	private StatisShopDayMapper statisShopDayMapper;
	@Resource
	private StatisGroupDayMapper statisGroupDayMapper;
	
	@Resource
	private StatisShopMonthMapper statisShopMonthMapper;
	@Resource
	private StatisGroupMonthMapper statisGroupMonthMapper;
	@Resource
	private BonusSendLogMapper bonusSendLogMapper;

	@Resource
	private TradeOfflineMapper tradeOfflineMapper;
	
	
	
	
	@Override
	public StatisShopDay queryStatisShopDayData(TransDataReportInDTO transDataReportInDTO) throws Exception {
		return statisShopDayMapper.queryStatisShopDayData(transDataReportInDTO);
	}

	

	@Override
	public StatisGroupDay queryStatisGroupDayData(TransDataReportInDTO transDataReportInDTO) throws Exception {
		return statisGroupDayMapper.queryStatisGroupDayData(transDataReportInDTO);
	}

	
	@Override
	public StatisShopMonth queryStatisShopMonthData(TransDataReportInDTO transDataReportInDTO) throws Exception {
		return statisShopMonthMapper.queryStatisShopMonthData(transDataReportInDTO);
	}
	
	
	
	@Override
	public StatisGroupMonth queryStatisGroupMonthData(TransDataReportInDTO transDataReportInDTO) throws Exception {
		return statisGroupMonthMapper.queryStatisGroupMonthData(transDataReportInDTO);
	}

	@Override
	public BonusSendLog querySendBonusAmountDay(TransDataReportInDTO transDataReportInDTO) {
		return bonusSendLogMapper.querySendBonusAmountDay(transDataReportInDTO);
	}

	@Override
	public TradeOffline queryVerifyBonusAmountDay(TransDataReportInDTO transDataReportInDTO) throws Exception {
		return tradeOfflineMapper.queryVerifyBonusAmountDay(transDataReportInDTO);
	}

	@Override
	public TradeOffline queryVerifyBonusAmountMonth(TransDataReportInDTO transDataReportInDTO) throws Exception {
//		transDataReportInDTO.setStringStatisDate(transDataReportInDTO.getStringStatisDate()+"0"+0);
//		transDataReportInDTO.setStringStatisDateEnd(transDataReportInDTO.getStringStatisDateEnd()+"0"+'0');
		return tradeOfflineMapper.queryVerifyBonusAmountMonth(transDataReportInDTO);

	}

	@Override
	public BonusSendLog querySendBonusAmountMonth(TransDataReportInDTO transDataReportInDTO) throws Exception {
	/*	transDataReportInDTO.setStringStatisDate(transDataReportInDTO.getStringStatisDate()+"0"+0);
		transDataReportInDTO.setStringStatisDateEnd(transDataReportInDTO.getStringStatisDateEnd()+"0"+'0');*/
		return bonusSendLogMapper.querySendBonusAmountMonth(transDataReportInDTO);
	}

	//现金交易
	@Override
	public TradeOffline queryCash(TransDataReportInDTO transDataReportInDTO) throws Exception {
		transDataReportInDTO.setPayType(BizEnum.PaymentType.Cash.getType());
		return tradeOfflineMapper.queryCash(transDataReportInDTO);
	}

	@Override
	public TradeOffline queryCashMonth(TransDataReportInDTO transDataReportInDTO) throws Exception {
//		transDataReportInDTO.setStringStatisDate(transDataReportInDTO.getStringStatisDate()+"0"+0);
//		transDataReportInDTO.setStringStatisDateEnd(transDataReportInDTO.getStringStatisDateEnd()+"0"+'0');
		transDataReportInDTO.setPayType(BizEnum.PaymentType.Cash.getType());
		return tradeOfflineMapper.queryCashMonth(transDataReportInDTO);
	}

	@Override
	public TradeOffline queryAgentCash(TransDataReportInDTO transDataReportInDTO) throws Exception {
		if(transDataReportInDTO.getQueryDayOrMonth()==2){
			transDataReportInDTO.setStringStatisDate(transDataReportInDTO.getStringStatisDate()+"0"+0);
			if(transDataReportInDTO.getStringStatisDateEnd() !=null){
				transDataReportInDTO.setStringStatisDateEnd(transDataReportInDTO.getStringStatisDateEnd()+"0"+'0');
			}
		}
		transDataReportInDTO.setPayType(BizEnum.PaymentType.Cash.getType());
		return tradeOfflineMapper.queryAgentCash(transDataReportInDTO);
	}

	//代理商后台交易流水
	@Override
	public StatisShopDay queryAgentStatisShopDayData(TransDataReportInDTO transDataReportInDTO) {
		return statisShopDayMapper.queryAgentStatisShopDayData(transDataReportInDTO);
	}



	@Override
	public StatisShopMonth queryAgentStatisShopMonthData(TransDataReportInDTO transDataReportInDTO) {
		return statisShopMonthMapper.queryAgentStatisShopMonthData(transDataReportInDTO);
	}




}
